package com.jt.www.biz.pay.controller;

import com.jt.www.biz.pay.service.PayUrlInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "支付地址接口", tags = {"PAY-URL-API"}, description = "支付地址接口")
@RestController
@RequestMapping(value = "/payUrl")
public class PayUrlInfoController {

    public static final Logger log = LoggerFactory.getLogger(PayUrlInfoController.class);

    @Autowired
    private PayUrlInfoService payUrlInfoService;


    @ApiOperation(value = "根据投保单号查询支付地址", notes = "根据投保单号查询支付地址", httpMethod = "GET")
    @GetMapping(value = "/queryPayUrl", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
    public ResponseEntity queryPayUrl(@ApiParam(value = "投保单号", required = true) @RequestParam("appCode") String appCode) {

        String findCode = "queryPayUrl_" + System.currentTimeMillis();

        log.info("{} 根据投保单号查询支付地址 入参：{}", findCode, appCode);

        return payUrlInfoService.queryPayUrl(findCode, appCode);
    }
}
